const express = require('express')
const router = express.Router()
// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi') 
const {update_userinfo_schema,update_password_schema,update_avtatar_schema} = require('../scgena/user')

const userinfo_handler = require('../router_handler/userinfo')
// 获取用户列表
router.get('/user',userinfo_handler.getUser)
// 获取用户基本信息
router.get('/userinfo',expressJoi(update_userinfo_schema),userinfo_handler.getUserInfo)
// 更新用户信息的路由
router.post('/userinfo',expressJoi(update_userinfo_schema),userinfo_handler.updateUserInfo)
// 修改用户密码的路由
router.post('/updatepwd',expressJoi(update_password_schema),userinfo_handler.updadePassword)
// 更换头像的路由
router.post('/update/avatar',expressJoi(update_avtatar_schema),userinfo_handler.updateAvatar)
module.exports =router